home *** CD-ROM | disk | FTP | other *** search
/ Chip 2011 November / CHIP_2011_11.iso / Programy / Inne / Gry / Carnage_Contest / scripts / CC Original / movement / Neutralizer.lua < prev    next >
Text File  |  2010-07-27  |  2KB  |  60 lines

  1. --------------------------------------------------------------------------------
  2. -- Weapon Neutralizer
  3. -- Original Carnage Contest Weapon
  4. -- Script by DC, September 2009, www.UnrealSoftware.de
  5. --------------------------------------------------------------------------------
  6.  
  7. -- Setup Tables
  8. if cc==nil then cc={} end
  9. cc.neutralizer={}
  10.  
  11. -- Load & Prepare Ressources
  12. cc.neutralizer.gfx_wpn=loadgfx("weapons/neutralizer.png")                        -- Weapon Image
  13. setmidhandle(cc.neutralizer.gfx_wpn)
  14. cc.neutralizer.sfx_heal=loadsfx("selfhealing.ogg")
  15.  
  16. --------------------------------------------------------------------------------
  17. -- Weapon: Neutralizer
  18. --------------------------------------------------------------------------------
  19.  
  20. cc.neutralizer.id=addweapon("cc.neutralizer","Effect Neutralizer",cc.neutralizer.gfx_wpn,0)    -- Add Weapon (0 uses)
  21.  
  22. function cc.neutralizer.draw()                                                -- Draw
  23.     -- Do nothing!
  24. end
  25.  
  26. function cc.neutralizer.attack(attack)                                        -- Attack
  27.     if (weapon_shots<=0) then
  28.         if (attack==1) then
  29.             -- Use weapon and allow to use another one afterwards (1)
  30.             useweapon(1)
  31.             weapon_shots=weapon_shots+1
  32.             -- Remove States
  33.             playerstate(0,state_poisoned,0)
  34.             playerstate(0,state_confused,0)
  35.             playerstate(0,state_frozen,0)
  36.             -- Effect
  37.             playsound(cc.neutralizer.sfx_heal)
  38.             x=getplayerx(0)
  39.             y=getplayery(0)+3
  40.             particle(p_muzzle,x,y)
  41.             particlesize(1,1)
  42.             particlecolor(255,0,150)
  43.             particlealpha(1.0)
  44.             particlefadealpha(0.01)
  45.             particle(p_muzzle,x,y)
  46.             particlesize(1,2)
  47.             particlecolor(255,0,150)
  48.             particlealpha(1.0)
  49.             particlefadealpha(0.02)
  50.             particlerotation(0)
  51.             for j=1,15,1 do
  52.                 particle(p_flare,x-10.0+math.random()*20.0,y+math.random()*10.0)
  53.                 particlesize(3.0,3.0)
  54.                 particlecolor(255,0,150)
  55.                 particlespeed(0,math.random(2,15)*-0.1)
  56.                 particlefadealpha(0.01)
  57.             end
  58.         end
  59.     end
  60. end